 

/*样式函数方法*/
@mixin maxWidth($auto: Auto) {
  max-width: 19.2rem;

  @if ($auto ==Auto) {
    margin-left: auto;
    margin-right: auto;
  }
}

// 图片
@mixin img() {
  img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border: none;
    // @include background_color("image-default");
    @content;
  }
}

// flex居中
@mixin flex-center() {
  display: flex !important;
  justify-content: center;
  align-items: center;
}

// rem转换：默认传数字会直接以100px=1rem进行计算
@function px2rem($value, $base-font-size: 100) {
  $currentUnit: unit($value);

  @if unitless($value) {
    @return calc(($value / $base-font-size) * 1rem);
    // @return calc(($value /1920) * 100vw);
  }

  @else if($currentUnit ==px) {
    @return calc(($value / 100px) * 1rem);
  }

  @else if ($currentUnit =='%') {
    @return $value;
  }

  @else if ($currentUnit ==em) {
    @return $value;
  }

  @else {
    @return $value;
  }
}



// 模块的左右间距
@mixin padding-content {
  width: $pageWidth;
  padding: $pagePadding;
}

// 滚动条样式(弹框询盘)
@mixin scrollbar() {
  &::-webkit-scrollbar {
    /*滚动条整体样式*/
    width: px2rem(6);
    /*高宽分别对应横竖滚动条的尺寸*/
    height: 1px;
  }

  &::-webkit-scrollbar-thumb {
    /*滚动条里面小方块*/
    border-radius: px2rem(2);
    @include background_color("scroll-thumb");
  }

  &::-webkit-scrollbar-track {
    /*滚动条里面轨道*/
    border-radius: 10px;
    @include background_color("scroll-track");
  }

  @content;
}

@mixin ellipsis-3() {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  white-space: initial;
  word-break: break-all;
}

@mixin ellipsis-2() {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: initial;
  word-break: break-all;
}

@mixin ellipsis {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  word-break: break-all;
}